﻿/// <reference path="../Client/bundels/libs.js" />
/// <reference path="../Client/Shared/Collection.js" />

describe("Collection", function () {
    var collection = new Collection();
    collection.add({ id: 1, firstName: "Cristi" });

    it("add & get", function () {
        //act
        var result = collection.get();

        //assert
        expect(result).not.toBeNull();        
        expect(result.length).toEqual(1);
    });    

    it("edit", function () {
        //act
        var result = collection.get();
        collection.edit({ id: 1, firstName: "Cristian" });

        //assert
        expect(result).not.toBeNull();
        expect(result.length).toEqual(1);
        expect(result[0].firstName).toEqual("Cristian");
    });

    it("remove", function () {
        //act
        collection.remove(1);
        var result = collection.get();

        //assert
        expect(result).not.toBeNull();
        expect(result.length).toEqual(0);
    });
});